﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Text;
using System.Windows.Forms;

namespace Serviio.WHS2011
{
    public static class GuiHelper
    {
        public class BorderSides
        {
            public BorderSides() { }

            public BorderSides(bool top, bool right, bool bottom, bool left)
            {
                Top = top;
                Right = right;
                Bottom = bottom;
                Left = left;
            }

            public bool Top = true;
            public bool Right = true;
            public bool Bottom = true;
            public bool Left = true;
        }

        public static void DrawBorder(PaintEventArgs target, Control control, BorderSides sides = null)
        {
            Graphics g = target.Graphics;
            Rectangle area = target.ClipRectangle;
            if (!target.ClipRectangle.Equals(control.ClientRectangle))
            {
                area = control.ClientRectangle;
            }

            Pen pen = new Pen(Color.FromArgb(181, 203, 165));
            int x1 = 0;
            int y1 = 0;
            int x2 = area.Width - 1;
            int y2 = area.Height - 1;
            if (sides == null || sides.Top)
                g.DrawLine(pen, new Point(x1, y1), new Point(x2, y1));
            if (sides == null || sides.Right)
                g.DrawLine(pen, new Point(x2, y1), new Point(x2, y2));
            if (sides == null || sides.Bottom)
                g.DrawLine(pen, new Point(x1, y2), new Point(x2, y2));
            if (sides == null || sides.Left)
                g.DrawLine(pen, new Point(x1, y1), new Point(x1, y2));
        }
    }
}
